<html>

<head>
<meta name=标题 content="">
<meta name=关键词 content="">
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=Generator content="Microsoft Word 15 (filtered)">
<style>
<!--
 /* Font Definitions */
@font-face
	{font-family:"Courier New";
	panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
	{font-family:Times;
	panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
	{font-family:Wingdings;
	panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
	{font-family:"Cambria Math";
	panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
	{font-family:DengXian;
	panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
	{font-family:"\@DengXian";}
@font-face
	{font-family:"Microsoft YaHei";
	panose-1:2 11 5 3 2 2 4 2 2 4;}
@font-face
	{font-family:Menlo;
	panose-1:2 11 6 9 3 8 4 2 2 4;}
@font-face
	{font-family:"\@Microsoft YaHei";}
 /* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:12.0pt;
	font-family:DengXian;}
code
	{font-family:Courier;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
	{margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	text-indent:21.0pt;
	font-size:12.0pt;
	font-family:DengXian;}
p.a, li.a, div.a
	{margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	line-height:200%;
	font-size:12.0pt;
	font-family:"Microsoft YaHei";}
.MsoChpDefault
	{font-family:DengXian;}
 /* Page Definitions */
@page WordSection1
	{size:595.0pt 842.0pt;
	margin:72.0pt 90.0pt 72.0pt 90.0pt;
	layout-grid:15.6pt;}
div.WordSection1
	{page:WordSection1;}
 /* List Definitions */
ol
	{margin-bottom:0cm;}
ul
	{margin-bottom:0cm;}
-->
</style>

</head>

<body lang=ZH-CN style='text-justify-trim:punctuation'>

<div class=WordSection1 style='layout-grid:15.6pt'>

<p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
style='font-size:14.0pt;line-height:200%;font-family:"Microsoft YaHei"'>grep</span></b></p>

<p class=MsoNormal align=left style='margin-bottom:12.0pt;text-align:left;
text-indent:21.0pt;line-height:200%;text-autospace:none'><span
style='font-family:"Microsoft YaHei";color:black;vertical-align:sub'>按照指定的模式，在文件中搜索匹配的行，将结果显示在标准输出。另外还有两个指令<span
lang=EN-US>egrep</span>相当于<span lang=EN-US>grep –E</span>，<span lang=EN-US>fgrep</span>相当于<span
lang=EN-US>grep -F</span>。如果没有给出文件名，那么从标准输入读取。</span></p>

<p class=MsoNormal align=left style='margin-bottom:12.0pt;text-align:left;
text-indent:21.0pt;line-height:200%;text-autospace:none'><span
style='font-family:"Microsoft YaHei";color:black;vertical-align:sub'>此命令的适用范围：<span
lang=EN-US>RedHat</span>、<span lang=EN-US>RHEL</span>、<span lang=EN-US>Ubuntu</span>、<span
lang=EN-US>CentOS</span>、<span lang=EN-US>SUSE</span>、<span lang=EN-US>openSUSE</span>、<span
lang=EN-US>Fedora</span>。</span></p>

<p class=MsoNormal align=left style='margin-bottom:12.0pt;text-align:left;
text-indent:21.0pt;line-height:200%;text-autospace:none'><span lang=EN-US
style='font-family:"Microsoft YaHei"'>&nbsp;</span></p>

<p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
style='font-family:"Microsoft YaHei"'>1</span></b><b><span style='font-family:
"Microsoft YaHei"'>、语法</span></b></p>

<p class=MsoNormal style='text-indent:21.0pt;line-height:200%'><b><span
lang=EN-US style='font-family:"Microsoft YaHei"'>grep  [</span></b><b><span
style='font-family:"Microsoft YaHei"'>选项<span lang=EN-US>]  PATTERN  files</span></span></b></p>

<p class=MsoNormal style='text-indent:21.0pt;line-height:200%'><b><span
lang=EN-US style='font-family:"Microsoft YaHei"'>grep  [OPTIONS]  [-e PATTERN |
-f FILE]  [FILE...]</span></b></p>

<p class=MsoNormal style='text-indent:21.0pt;line-height:200%'><b><span
lang=EN-US style='font-family:"Microsoft YaHei"'>&nbsp;</span></b></p>

<p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
style='font-family:"Microsoft YaHei"'>2</span></b><b><span style='font-family:
"Microsoft YaHei"'>、选项列表</span></b></p>

<table class=MsoTableGrid border=1 cellspacing=0 cellpadding=0 width="95%"
 style='width:95.0%;margin-left:24.1pt;border-collapse:collapse;border:none'>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  background:#E7E6E6;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>选项</span></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border:solid windowtext 1.0pt;
  border-left:none;background:#E7E6E6;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>说明</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-V | --version</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>显示命令版本信息</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>--help</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>显示帮助文档</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;background:#E7E6E6;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>匹配选择</span></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  background:#E7E6E6;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>&nbsp;</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-E | --extended-regexp</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>使用扩展规则表达式解释匹配模式</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-F | --fixed-strings</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>将匹配模式看做固定字符串</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-G | --basic-regexp</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>使用基本规则表达式解释匹配模式</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-P | --perl-regexp</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>使用<span
  lang=EN-US>perl</span>表达式解释匹配模式</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;background:#E7E6E6;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>文件和目录选择控制</span></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  background:#E7E6E6;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>&nbsp;</span></p>
  </td>
 </tr>
 <tr style='height:32.3pt'>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:32.3pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-a | --text</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt;height:32.3pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>忽略二进制数据</span></p>
  </td>
 </tr>
 <tr style='height:32.3pt'>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:32.3pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>--binary-files=TYPE</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt;height:32.3pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>如果文件的前几个字节表示该文件包含二进制数据，则假定该文件类型是<span
  lang=EN-US>TYPE</span>。默认情况下，<span lang=EN-US>TYPE</span>为二进制，<span
  lang=EN-US>grep</span>通常输出一行消息表示二进制文件匹配，如果没有匹配则不输出消息。如果类型不匹配，<span
  lang=EN-US>grep</span>假定二进制文件不匹配；这相当于<span lang=EN-US>-i</span>选项。如果<span
  lang=EN-US>TYPE</span>是文本，<span lang=EN-US>grep</span>会像处理文本一样处理二进制文件；这相当于<span
  lang=EN-US>-a</span>选项。警告：<span lang=EN-US>“grep-binary-files=text”</span>可能会输出二进制垃圾，如果输出是终端，并且终端驱动程序将其中的一些解释为命令，则会产生严重的副作用。</span></p>
  </td>
 </tr>
 <tr style='height:32.3pt'>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:32.3pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-D action | --devices=ACTION</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt;height:32.3pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>如果输入文件是一个设备文件，那么用指定的<span
  lang=EN-US>action</span>处理。<span lang=EN-US>read</span>，像普通文件一样读取设备，<span
  lang=EN-US>skip</span>，忽略设备</span></p>
  </td>
 </tr>
 <tr style='height:32.3pt'>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:32.3pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-d action | --directories=ACTION</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt;height:32.3pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>如果查找的是目录文件，那么使用指定的操作处理。<span
  lang=EN-US>read</span>，像普通文件一样读取目录；<span lang=EN-US>skip</span>，忽略目录；<span
  lang=EN-US>recursive</span>，递归当时读取子目录下文件。</span></p>
  </td>
 </tr>
 <tr style='height:32.3pt'>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:32.3pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>--exclude=per</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt;height:32.3pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>忽略文件名匹配<span
  lang=EN-US>per</span>的文件<span lang=EN-US>       </span></span></p>
  </td>
 </tr>
 <tr style='height:32.3pt'>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:32.3pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>--exclude-from=FILE</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt;height:32.3pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>跳过其基本名称与从<span
  lang=EN-US>FILE</span>中读取的任何文件名全局匹配的文件。</span></p>
  </td>
 </tr>
 <tr style='height:32.3pt'>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:32.3pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>--exclude-dir=DIR</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt;height:32.3pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>从递归搜索中排除匹配模式<span
  lang=EN-US>DIR</span>的目录</span></p>
  </td>
 </tr>
 <tr style='height:32.3pt'>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:32.3pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-I</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt;height:32.3pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>处理二进制文件，就像它不包含匹配的数据一样；等价于“<span
  lang=EN-US>--binary-files=without-match</span>”</span></p>
  </td>
 </tr>
 <tr style='height:32.3pt'>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:32.3pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>--include=GLOB</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt;height:32.3pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>只搜索其基本名称与<span
  lang=EN-US>GLOB</span>匹配的文件</span></p>
  </td>
 </tr>
 <tr style='height:32.3pt'>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:32.3pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-R | -r | --recursive</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt;height:32.3pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>递归方式读取目录下所有文件</span></p>
  </td>
 </tr>
 <tr style='height:32.3pt'>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;background:#E7E6E6;padding:0cm 5.4pt 0cm 5.4pt;height:32.3pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>行数控制</span></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  background:#E7E6E6;padding:0cm 5.4pt 0cm 5.4pt;height:32.3pt'>
  <p class=MsoNormal style='line-height:200%'><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>&nbsp;</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-A num | --after-context=NUM</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>显示匹配行以及之后指定的行数</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-B num | --before-context=NUM</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>显示匹配行以及之前指定的行数</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-C num | -NUM | --context=NUM</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>显示匹配行以及之前和之后的指定行数</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;background:#E7E6E6;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>输出行控制</span></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  background:#E7E6E6;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>&nbsp;</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-b | --byte-offset</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>在显示匹配的行之前，打印该行第一个字符的偏移位置</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-H | --with-filename</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>为每个匹配的行显示文件名，如果有多个文件的话，这是默认操作</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-h | --no-filename</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>显示匹配的行，但是不显示文件名。如果搜索一个文件时，这是默认操作</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-n | --line-number</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>显示匹配的行之前，显示行号</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-T | --initial-tab</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>确保实际行内容的第一个字符位于制表符停止上，使制表符的对齐看起来正常。</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-u | --unix-byte-offsets</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>报告<span
  lang=EN-US>Unix</span>样式的字节偏移量。此开关使<span lang=EN-US>grep</span>报告字节偏移量，就像文件是<span
  lang=EN-US>Unix</span>样式的文本文件一样</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-Z | --null</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>输出一个零字节<span
  lang=EN-US>(ASCII null</span>字符<span lang=EN-US>)</span>，而不是通常跟随文件名的字符。例如，“<span
  lang=EN-US>grep –lz</span>”在每个文件名之后输出一个零字节，而不是通常的换行符。</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;background:#E7E6E6;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>输出控制</span></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  background:#E7E6E6;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>&nbsp;</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-c | --count</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>统计符合匹配的行数</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>--color[=WHEN] |  --colour[=WHEN]</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>用转义序列包围匹配<span
  lang=EN-US>(</span>非空<span lang=EN-US>)</span>字符串、匹配行、上下文行、文件名、行号、字节偏移量和分隔符<span
  lang=EN-US>(</span>用于字段和上下文行组<span lang=EN-US>)</span>，以便在终端上显示它们的颜色。颜色由环境变量<span
  lang=EN-US>grep_colors</span>定义。仍然支持不推荐的环境变量<span lang=EN-US>grep_color</span>，但它的设置没有优先级。<span
  lang=EN-US>WHEN</span>的有效值是<span lang=EN-US>never</span>，<span lang=EN-US>always</span>，<span
  lang=EN-US>auto</span>。</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-L | --files-without-match</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>禁止正常输出；而是打印通常不会输出的每个输入文件的名称。扫描将在第一次匹配的时候停止。</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-l</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>显示内容符合指定匹配模式的文件名</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-m num  |  --max-count=NUM</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>在匹配<span
  lang=EN-US>num</span>行之后，停止搜索</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-o | --only-matching</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>只显示匹配行的匹配字符</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-q | --quite</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>静默模式，搜索完成之后返回<span
  lang=EN-US>0</span></span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-s | --no-messages</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>不显示文件不存在和文件不可读的错误信息</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;background:#E7E6E6;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>模式控制</span></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  background:#E7E6E6;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>&nbsp;</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-e parttern  |  --regexp=PATTERN</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>设置匹配模式</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-f file  | --file=FILE</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>将给定的文件内容作为匹配模式</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-i  |  --ignore-case</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>忽略大小写</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-v | --invert-match</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>显示不符合匹配模式的行</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-w | --word-regexp</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>显示整个字都匹配的行</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-x | --line-regexp</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>显示整行都匹配的行</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;background:#E7E6E6;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>其他选项</span></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  background:#E7E6E6;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>&nbsp;</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>--line-buffered</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>对输出使用行缓冲。这会导致性能损失。</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>--mmap</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>如果可能，使用<span
  lang=EN-US>mmap(2)</span>系统调用来读取输入，而不是默认的<span lang=EN-US>read(2)</span>系统调用。在某些情况下，<span
  lang=EN-US>mmap</span>会产生更好的性能。但是，<span lang=EN-US>-mmap</span>可能导致未定义的行为<span
  lang=EN-US>(</span>包括核心转储<span lang=EN-US>)</span>，如果一个输入文件在<span lang=EN-US>grep</span>运行时收缩，或者如果发生<span
  lang=EN-US>I/O</span>错误。</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-U | --binary</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>将文件视为二进制文件。</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-z | --null-data</span></b></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>将输入视为一组行，每一行以零字节<span
  lang=EN-US>(ASCII NUL</span>字符<span lang=EN-US>)</span>结尾，而不是换行符。</span></p>
  </td>
 </tr>
</table>

<p class=MsoNormal style='line-height:200%'><span lang=EN-US style='font-family:
"Microsoft YaHei"'>&nbsp;</span></p>

<p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
style='font-family:"Microsoft YaHei"'>3</span></b><b><span style='font-family:
"Microsoft YaHei"'>、环境变量</span></b></p>

<p class=MsoNormal style='text-indent:21.0pt;line-height:200%'><span
lang=EN-US style='font-family:"Microsoft YaHei"'>grep</span><span
style='font-family:"Microsoft YaHei"'>的行为受到以下环境变量的影响。</span></p>

<p class=MsoNormal style='text-indent:21.0pt;line-height:200%'><b><span
lang=EN-US style='font-family:"Microsoft YaHei"'>GREP_OPTIONS</span></b><span
style='font-family:"Microsoft YaHei"'>，此变量指定放置在任何显式选项前面的默认选项。选项规范由空格分隔。反斜杠转义下一个字符，因此它可以指定包含空格或反斜杠的选项。例如，如果<span
lang=EN-US>GREP_OPTIONS</span>是<span lang=EN-US>’--binary-files=without-match --directories=skip’</span>，那么<span
lang=EN-US>grep</span>执行的时候就假设已经有了这两个选项。</span></p>

<p class=MsoNormal style='text-indent:21.0pt;line-height:200%'><b><span
lang=EN-US style='font-family:"Microsoft YaHei"'>GREP_COLOR</span></b><span
style='font-family:"Microsoft YaHei"'>，此变量指定用于突出显示匹配<span lang=EN-US>(</span>非空<span
lang=EN-US>)</span>文本的颜色。</span></p>

<p class=MsoNormal style='text-indent:21.0pt;line-height:200%'><b><span
lang=EN-US style='font-family:"Microsoft YaHei"'>GREP_COLORS</span></b><span
style='font-family:"Microsoft YaHei"'>，指定用于突出显示输出的各个部分的颜色和其他属性。它的值是一个以冒号分隔的功能列表，默认为<span
lang=EN-US>ms=01</span>；<span lang=EN-US>31:mc=01</span>；<span lang=EN-US>31:sl=</span>：<span
lang=EN-US>cx=</span>：<span lang=EN-US>fn=35:ln=32:bn=32:se=36</span>，省略了<span
lang=EN-US>rv</span>和<span lang=EN-US>ne</span>布尔功能<span lang=EN-US>(</span>即<span
lang=EN-US>false)</span>。支持的功能如下所示。</span></p>

<p class=MsoNormal style='margin-left:21.0pt;text-indent:21.0pt;line-height:
200%'><b><span lang=EN-US style='font-family:"Microsoft YaHei"'>sl=</span></b><span
style='font-family:"Microsoft YaHei"'>，用于整个选定行的<span lang=EN-US>SGR</span>子字符串<span
lang=EN-US>(</span>即<span lang=EN-US>-v</span>命令行选项省略时的匹配行，或指定<span lang=EN-US>-v</span>时不匹配的行<span
lang=EN-US>)</span>。但是，如果指定了布尔<span lang=EN-US>rv</span>功能和<span lang=EN-US>-v</span>命令行选项，则它将应用于上下文匹配行。默认值为空<span
lang=EN-US>(</span>即终端的默认颜色对<span lang=EN-US>)</span>。</span></p>

<p class=MsoNormal style='margin-left:21.0pt;text-indent:21.0pt;line-height:
200%'><b><span lang=EN-US style='font-family:"Microsoft YaHei"'>cx=</span></b><span
style='font-family:"Microsoft YaHei"'>，用于整个上下文行的<span lang=EN-US>SGR</span>子字符串<span
lang=EN-US>(</span>即省略<span lang=EN-US>-v</span>命令行选项时的非匹配行，或指定<span
lang=EN-US>-v</span>时的匹配行<span lang=EN-US>)</span>。但是，如果指定了布尔<span lang=EN-US>RV</span>功能和<span
lang=EN-US>-v</span>命令行选项，则它将适用于选定的非匹配行。默认值为空<span lang=EN-US>(</span>即终端的默认颜色对<span
lang=EN-US>)</span>。</span></p>

<p class=MsoNormal style='margin-left:21.0pt;text-indent:21.0pt;line-height:
200%'><b><span lang=EN-US style='font-family:"Microsoft YaHei"'>rv</span></b><span
style='font-family:"Microsoft YaHei"'>，当指定<span lang=EN-US>-v</span>命令行选项时，逆转<span
lang=EN-US>(</span>掉期<span lang=EN-US>)“sl=”</span>和<span lang=EN-US>“cx=”</span>功能的布尔值。缺省值为<span
lang=EN-US>false(</span>即省略了功能<span lang=EN-US>)</span>。</span></p>

<p class=MsoNormal style='margin-left:21.0pt;text-indent:21.0pt;line-height:
200%'><b><span lang=EN-US style='font-family:"Microsoft YaHei"'>mt=01</span></b><b><span
style='font-family:"Microsoft YaHei"'>；<span lang=EN-US>31</span></span></b><span
style='font-family:"Microsoft YaHei"'>，用于匹配任何行中的非空文本的<span lang=EN-US>sgr</span>子字符串。<span
lang=EN-US>(</span>这仅在省略<span lang=EN-US>-v</span>命令行选项时使用。<span lang=EN-US>)</span>当启动时，<span
lang=EN-US>sl=(</span>或<span lang=EN-US>cx=)</span>能力的效果保持活跃。默认值是当前行背景上的粗体红色文本前景。</span></p>

<p class=MsoNormal style='margin-left:21.0pt;text-indent:21.0pt;line-height:
200%'><b><span lang=EN-US style='font-family:"Microsoft YaHei"'>ms=01</span></b><b><span
style='font-family:"Microsoft YaHei"'>；<span lang=EN-US>31</span></span></b><span
style='font-family:"Microsoft YaHei"'>，用于匹配选定行中的非空文本的<span lang=EN-US>sgr</span>子字符串。<span
lang=EN-US>(</span>这仅在省略<span lang=EN-US>-v</span>命令行选项时使用。<span lang=EN-US>)</span>当启动时，<span
lang=EN-US>sl=(</span>或<span lang=EN-US>cx=)</span>能力的效果保持活跃。默认值是当前行背景上的粗体红色文本前景。</span></p>

<p class=MsoNormal style='margin-left:21.0pt;text-indent:21.0pt;line-height:
200%'><b><span lang=EN-US style='font-family:"Microsoft YaHei"'>mc=01</span></b><b><span
style='font-family:"Microsoft YaHei"'>；<span lang=EN-US>31</span></span></b><span
style='font-family:"Microsoft YaHei"'>，用于匹配上下文行中的非空文本的<span lang=EN-US>sgr</span>子字符串。<span
lang=EN-US>(</span>这仅在省略<span lang=EN-US>-v</span>命令行选项时使用。<span lang=EN-US>)</span>当启动时，<span
lang=EN-US>sl=(</span>或<span lang=EN-US>cx=)</span>能力的效果保持活跃。默认值是当前行背景上的粗体红色文本前景。</span></p>

<p class=MsoNormal style='margin-left:21.0pt;text-indent:21.0pt;line-height:
200%'><b><span lang=EN-US style='font-family:"Microsoft YaHei"'>fn=35</span></b><span
style='font-family:"Microsoft YaHei"'>，用于任何内容行前缀的文件名的<span lang=EN-US>SGR</span>子字符串。默认值是终端默认背景上的洋红色文本前景。</span></p>

<p class=MsoNormal style='margin-left:21.0pt;text-indent:21.0pt;line-height:
200%'><b><span lang=EN-US style='font-family:"Microsoft YaHei"'>ln=32</span></b><span
style='font-family:"Microsoft YaHei"'>，任何内容行前缀的行号的<span lang=EN-US>SGR</span>子字符串。默认值是终端默认背景上的绿色文本前景。</span></p>

<p class=MsoNormal style='margin-left:21.0pt;text-indent:21.0pt;line-height:
200%'><b><span lang=EN-US style='font-family:"Microsoft YaHei"'>bn=32</span></b><span
style='font-family:"Microsoft YaHei"'>，用于任何内容行前缀的字节偏移的<span lang=EN-US>SGR</span>子字符串。默认值是终端默认背景上的绿色文本前景。</span></p>

<p class=MsoNormal style='margin-left:21.0pt;text-indent:21.0pt;line-height:
200%'><b><span lang=EN-US style='font-family:"Microsoft YaHei"'>se=36</span></b><span
style='font-family:"Microsoft YaHei"'>，当指定了非零上下文（<span lang=EN-US>--</span>），<span
lang=EN-US>SGR</span>子字符串用于在选定的行字段<span lang=EN-US>(</span>：<span lang=EN-US>)</span>、上下文行字段之间<span
lang=EN-US>(-)</span>和相邻行组之间插入分隔符。默认值是终端默认背景上的青色文本前景。</span></p>

<p class=MsoNormal style='margin-left:21.0pt;text-indent:21.0pt;line-height:
200%'><b><span lang=EN-US style='font-family:"Microsoft YaHei"'>ne</span></b><span
style='font-family:"Microsoft YaHei"'>，布尔值，该值防止在每次彩色项结束时使用擦除入行<span lang=EN-US>(EL)</span>对右<span
lang=EN-US>(\33[K]</span>清除到行尾的值。这是在不支持<span lang=EN-US>EL</span>的终端上需要的。对于没有应用<span
lang=EN-US>Back_COLOR_ERASE(BCE)</span>布尔终止功能的终端、所选择的高亮颜色不影响背景、或者当<span
lang=EN-US>EL</span>太慢或导致过多闪烁时，它在其他情况下是有用的。默认值为<span lang=EN-US>false(</span>即省略功能<span
lang=EN-US>)</span></span></p>

<p class=MsoNormal style='text-indent:21.0pt;line-height:200%'><b><span
lang=EN-US style='font-family:"Microsoft YaHei"'>LC_ALL, LC_COLLATE, LANG</span></b><span
style='font-family:"Microsoft YaHei"'>，这些变量指定<span lang=EN-US>LC_COLLATE</span>类别的区域设置，该类别确定用于解释范围表达式<span
lang=EN-US>(</span>如<span lang=EN-US>[a-z])</span>的排序序列。</span></p>

<p class=MsoNormal style='text-indent:21.0pt;line-height:200%'><b><span
lang=EN-US style='font-family:"Microsoft YaHei"'>LC_ALL, LC_CTYPE, LANG</span></b><span
style='font-family:"Microsoft YaHei"'>，这些变量指定<span lang=EN-US>LC_CTYPE</span>类别的区域设置，它决定字符的类型，例如，哪些字符是空格。</span></p>

<p class=MsoNormal style='text-indent:21.0pt;line-height:200%'><b><span
lang=EN-US style='font-family:"Microsoft YaHei"'>LC_ALL, LC_MESSAGES, LANG</span></b><span
style='font-family:"Microsoft YaHei"'>，这些变量指定<span lang=EN-US>LC_MESSAGES</span>类别的区域设置，它确定<span
lang=EN-US>grep</span>用于消息的语言。默认的<span lang=EN-US>C</span>语言环境使用美式英语消息。</span></p>

<p class=MsoNormal style='text-indent:21.0pt;line-height:200%'><b><span
lang=EN-US style='font-family:"Microsoft YaHei"'>POSIXLY_CORRECT</span></b><span
style='font-family:"Microsoft YaHei"'>，如果设置，<span lang=EN-US>grep</span>的行为与<span
lang=EN-US>POSIX.2</span>所要求的一样；否则，<span lang=EN-US>grep</span>的行为更像其他<span
lang=EN-US>GNU</span>程序。<span lang=EN-US>POSIX.2</span>要求必须将文件名后面的选项视为文件名；默认情况下，这些选项被排到操作数列表的前面，并被视为选项。此外，<span
lang=EN-US>POSIX.2</span>还要求将未被承认的选项诊断为<span lang=EN-US>“</span>非法<span
lang=EN-US>”</span>，但由于它们并不真正违反法律，默认情况是将它们诊断为<span lang=EN-US>“</span>无效<span
lang=EN-US>”</span>。<span lang=EN-US>POSIXLY_RIDER</span>还禁用<span lang=EN-US>_N_GNU_NOOPTION_ARGV_LANGS_</span>，如下所述。</span></p>

<p class=MsoNormal style='text-indent:21.0pt;line-height:200%'><b><span
lang=EN-US style='font-family:"Microsoft YaHei"'>_N_GNU_nonoption_argv_flags_</span></b><span
style='font-family:"Microsoft YaHei"'>，<span lang=EN-US>(</span>这里<span
lang=EN-US>N</span>是<span lang=EN-US>grep</span>的数字进程<span lang=EN-US>ID</span>。<span
lang=EN-US>)</span>如果此环境变量值的<span lang=EN-US>ith</span>字符为<span lang=EN-US>1</span>，则不要将<span
lang=EN-US>grep</span>的<span lang=EN-US>ith</span>操作数视为选项，即使它似乎是选项之一。<span
lang=EN-US>shell</span>可以为其运行的每个命令在环境中放置此变量，指定哪些操作数是文件名通配符展开的结果，因此不应被视为选项。此行为仅在<span
lang=EN-US>GNU C</span>库中可用，且仅在未设置<span lang=EN-US>POSIXLY_RIDER</span>时才可用。</span></p>

<p class=MsoNormal style='text-indent:21.0pt;line-height:200%'><span
lang=EN-US style='font-family:"Microsoft YaHei"'>&nbsp;</span></p>

<p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
style='font-family:"Microsoft YaHei"'>4</span></b><b><span style='font-family:
"Microsoft YaHei"'>、退出码</span></b></p>

<p class=MsoNormal style='text-indent:21.0pt;line-height:200%'><span
style='font-family:"Microsoft YaHei"'>通常，如果找到选定的行，则退出状态为<span lang=EN-US>0</span>，否则为<span
lang=EN-US>1</span>。但是，如果发生错误，退出状态为<span lang=EN-US>2</span>，除非使用<span
lang=EN-US>-q</span>、<span lang=EN-US>--quite</span>、<span lang=EN-US>--slient</span>选项，并找到选定的行。但是，请注意，对于<span
lang=EN-US>grep</span>、<span lang=EN-US>CMP</span>和<span lang=EN-US>diff</span>等程序，<span
lang=EN-US>POSIX</span>只要求在出现错误时的退出状态大于<span lang=EN-US>1</span>；因此，出于可移植性的考虑，建议使用对此一般条件进行测试的逻辑，而不是与<span
lang=EN-US>2</span>严格相等的逻辑。</span></p>

<p class=MsoNormal style='line-height:200%'><span lang=EN-US style='font-family:
"Microsoft YaHei"'>&nbsp;</span></p>

<p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
style='font-family:"Microsoft YaHei"'>5</span></b><b><span style='font-family:
"Microsoft YaHei"'>、实例</span></b></p>

<p class=MsoNormal style='text-indent:21.0pt;line-height:200%'><span
lang=EN-US style='font-family:"Microsoft YaHei"'>1</span><span
style='font-family:"Microsoft YaHei"'>）显示文件中以<span lang=EN-US>2</span>开头的行</span></p>

<table class=a0 border=1 cellspacing=0 cellpadding=0 width="95%"
 style='width:95.0%;margin-left:24.1pt;border-collapse:collapse;border:none'>
 <tr style='height:14.9pt'>
  <td width=836 valign=top style='width:836.15pt;border:solid windowtext 1.0pt;
  background:#E7E6E6;padding:0cm 5.4pt 0cm 5.4pt;height:14.9pt'>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>[root@localhost
  weijie]# <b>cat 2.c</b></span></code></p>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>123</span></code></p>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>23</span></code></p>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>212</span></code></p>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>[root@localhost
  weijie]# <b>grep ^2 2.c         //</b></span></code><code><b><span
  style='font-size:10.0pt;line-height:200%;font-family:DengXian'>显示以</span></b></code><code><b><span
  lang=EN-US style='font-size:10.0pt;line-height:200%;font-family:Menlo'>2</span></b></code><code><b><span
  style='font-size:10.0pt;line-height:200%;font-family:DengXian'>开头的行</span></b></code></p>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>23</span></code></p>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>212</span></code></p>
  </td>
 </tr>
</table>

<p class=MsoNormal style='text-indent:21.0pt;line-height:200%'><span
lang=EN-US style='font-family:"Microsoft YaHei"'>2</span><span
style='font-family:"Microsoft YaHei"'>）显示不包含<span lang=EN-US>23</span>的行 </span></p>

<table class=a0 border=1 cellspacing=0 cellpadding=0 width="95%"
 style='width:95.0%;margin-left:24.1pt;border-collapse:collapse;border:none'>
 <tr style='height:14.9pt'>
  <td width=836 valign=top style='width:836.15pt;border:solid windowtext 1.0pt;
  background:#E7E6E6;padding:0cm 5.4pt 0cm 5.4pt;height:14.9pt'>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>[root@localhost
  weijie]# <b>grep -v 23 2.c</b></span></code></p>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>212</span></code></p>
  </td>
 </tr>
</table>

<p class=MsoNormal style='text-indent:21.0pt;line-height:200%'><span
lang=EN-US style='font-family:"Microsoft YaHei"'>3</span><span
style='font-family:"Microsoft YaHei"'>）显示整个字都匹配的行 </span></p>

<table class=a0 border=1 cellspacing=0 cellpadding=0 width="95%"
 style='width:95.0%;margin-left:24.1pt;border-collapse:collapse;border:none'>
 <tr style='height:14.9pt'>
  <td width=836 valign=top style='width:836.15pt;border:solid windowtext 1.0pt;
  background:#E7E6E6;padding:0cm 5.4pt 0cm 5.4pt;height:14.9pt'>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>[root@localhost
  weijie]# <b>grep -w 23 2.c</b></span></code></p>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>23</span></code></p>
  </td>
 </tr>
</table>

<p class=MsoNormal style='line-height:200%'><span lang=EN-US style='font-family:
"Microsoft YaHei"'>&nbsp;</span></p>

<p class=MsoNormal style='line-height:200%'><span lang=EN-US style='font-family:
"Microsoft YaHei"'>&nbsp;</span></p>

<p class=MsoNormal style='line-height:200%'><span lang=EN-US style='font-family:
"Microsoft YaHei"'>&nbsp;</span></p>

<p class=MsoNormal align=center style='text-align:center;line-height:200%'><span
lang=EN-US style='font-family:"Microsoft YaHei"'>Copyright@david 
zhytwj2018@163.com</span></p>

</div>

</body>

</html>
